//
//  SpriteKitEx.swift
//  Loop
//
//  Created by remy on 2021/10/21.
//

import SpriteKit

public extension SKNode {
    var y: CGFloat {
        get { return position.y }
        set { position.y = newValue }
    }
    
    var x: CGFloat {
        get { return position.x }
        set { position.x = newValue }
    }
}

public extension SKSpriteNode {
    var width: CGFloat {
        get { return size.width }
        set { size.width = newValue }
    }
    
    var height: CGFloat {
        get { return size.height }
        set { size.height = newValue }
    }
}

public extension SKLabelNode {
    convenience init(fontName: String,
                     fontSize: CGFloat,
                     fontColor: UIColor,
                     position: CGPoint = .zero,
                     text: String? = nil) {
        self.init(fontNamed: fontName)
        self.position = position
        self.fontSize = fontSize
        self.fontColor = fontColor
        self.text = text
    }
}
